﻿<shared:PageBase x:Class="Miris.HumanMilkAnalyser.WPF.CreatePatientPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:shared="clr-namespace:Miris.HumanMilkAnalyser.WPF.Shared"
      xmlns:validationRule="clr-namespace:Miris.HumanMilkAnalyser.WPF.ValidationRules"
      xmlns:userControl="clr-namespace:Miris.HumanMilkAnalyser.WPF.CustomizedUserControl"
      x:Name="CurrentPage"
      mc:Ignorable="d" 
      d:DesignHeight="580" d:DesignWidth="1160"
	  Title="CreatePatientPage" Style="{StaticResource DefaultPageStyle}" 
      DataContext="{Binding CreatePatient, Source={StaticResource Locator}}">
    <Page.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Skins/Storyboard/PageStoryborad.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Page.Resources>
    <Grid HorizontalAlignment="Center">
        <Grid.ColumnDefinitions>
            <!-- Back Button -->
            <ColumnDefinition Width="Auto" />
            <!-- Main Content -->
            <ColumnDefinition Width="Auto" />
            <!-- Next Button -->
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>
        <Button Margin="0,0,30,0" Width="47" Tag="/Skins/Resource/Image/Back.png" Style="{StaticResource OpacityImageButton}" Click="ButtonReturn_Click" />
        <!-- Trasparent effect Background -->
        <Border Grid.Column="1" Style="{StaticResource PageContentContainerBorder}">
            <Border Style="{StaticResource PageContentBackgroundBorder}" />
        </Border>
        <Grid Grid.Column="1" Width="1050" Height="550">
            <Grid.RowDefinitions>
                <!-- Sample number & Patient number -->
                <RowDefinition Height="60" />
                <!-- PatientInfoInputUserControl -->
                <RowDefinition Height="Auto" />
                <!-- Save & Check Report Buttons -->
                <RowDefinition Height="45" />
            </Grid.RowDefinitions>
            <Grid VerticalAlignment="Top" Height="40">
                <Grid.ColumnDefinitions>
                    <!-- Patient number label -->
                    <ColumnDefinition Width="Auto" />
                    <!-- Patient number -->
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <TextBlock Text="受测者ID：" VerticalAlignment="Center" Style="{StaticResource RegularTextBlock}" />
                <TextBox Grid.Column="1" x:Name="TxtPatientNumber" HorizontalAlignment="Left" 
                         Width="300" Height="35">
                    <TextBox.Text>
                        <Binding Path="Number" UpdateSourceTrigger="PropertyChanged">
                            <Binding.ValidationRules>
                                <validationRule:PatientNumberValidationRule />
                            </Binding.ValidationRules>
                        </Binding>
                    </TextBox.Text>
                    <TextBox.Style>
                        <Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource InfoTextBox}">
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding IsNewData}" Value="False">
                                    <Setter Property="IsReadOnly" Value="True" />
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </TextBox.Style>
                </TextBox>
            </Grid>
            <userControl:PatientInfoInputUserControl Grid.Row="1" DataContext="{Binding}" />
            <Button Grid.Row="2" HorizontalAlignment="Right" VerticalAlignment="Bottom" Content="保   存" Command="{Binding SaveCommand}" Style="{StaticResource RegularButton}" />
        </Grid>
        <Button Grid.Column="2" Margin="30,0,0,0" Width="47" Tag="/Skins/Resource/Image/Next.png" Style="{StaticResource OpacityImageButton}" Visibility="Hidden" />
    </Grid>
</shared:PageBase>
